package com.hc.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hc.bean.PageBean;
import com.hc.domain.Blog;
import com.hc.dto.ListBlogDTO;
import com.hc.mapper.BlogMapper;
import com.hc.service.BlogService;
import com.hc.vo.BlogAddVO;
import com.hc.vo.BlogQueryVO;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * 博客
 *
 * @author 梁云亮
 */
@Service
public class BlogServiceImpl extends ServiceImpl<BlogMapper, Blog> implements BlogService {

    @Resource
    private BlogMapper blogMapper;

    @Transactional(rollbackFor = Exception.class)
    @Override
    public int createBlog(BlogAddVO blogAddVO) {
        int res = 0;
        return res;
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public int batchCreateBlog(List<BlogAddVO> list) {
        int res = blogMapper.batchInsertBlog(list);
        return res;
    }

    @Override
    public Blog getBlogById(Integer id) {
        Blog blog = null;
        return blog;
    }

    @Override
    public int getBlogViews(Integer id) {
        int views = 0;
        return views;
    }

    @Override
    public int getBlogAgrees(Integer id) {
        int agrees = 0;
        return agrees;
    }

    @Override
    public PageBean<ListBlogDTO> listBlogsByCondition(Integer pageNum, Integer pageSize, BlogQueryVO blogQueryVO) {
        PageBean<ListBlogDTO> pageBean = null;
        return pageBean;
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public int increaseBlogViewsById(Integer id) {
        int res = 0;
        return res;
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public int decreaseBlogAgreesById(Integer id) {
        int res = 0;
        return res;
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public int modifyBlogStatusById(Integer id, Integer status) {
        int res = 0;
        return res;
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public int modifyBlogTopStatusById(Integer blogId) {
        int res = 0;
        return res;
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public int modifyBlogAdmireStatusById(Integer id) {
        int res = 0;
        return res;
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public int modifyBlogCommentStatusById(Integer id) {
        int res = 0;
        return res;
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public int modifyBlogRecommendStatusById(Integer id) {
        int res = 0;
        return res;
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public int modifyBlogCopyrightStatusById(Integer id) {
        int res = 0;
        return res;
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public int modifyBlogImgById(Integer id, String img) {
        int res = 0;
        return res;
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public int modifyBlogQRCodeById(Integer id, String qrcode) {
        int res = 0;
        return res;
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public int modifyBlog(Blog blog) {
        int res = 0;
        return res;
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public int batchModifyBlog(List<Blog> list) {
        int res = 0;
        return res;
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public int deleteBlogById(Integer id) {
        int res = 0;
        return res;
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public int deleteBlogsById(List<Integer> blogIds) {
        int res = 0;
        return res;
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public int batchDeleteBlogById(List<Integer> ids) {
        int res = 0;
        return res;
    }
}
